<template>
    <div class="box">
       <p>不凡留言板主页</p>
       <div class="search">
         <span> 筛选作者: </span><input type="text" v-model="search.author"> 
         <span>筛选内容：</span><input type="text" v-model="search.keyword">
         <button @click="searchFn">查询</button>
       </div>
        <bo-list :list='list' :isMy='false'></bo-list>
    </div>
</template>

<script>
import BoList from '@/components/list'
import Api from '@/api/messageboard'
export default {
  name: 'HelloWorld',
  components:{
    BoList
  },
  data () {
    return {
      msg: 'Welcome to Your Vue.js App',
      list:[],
      
      search:{
        author:'',
        keyword:''
      }
    }
  },
  created(){
      this.getList()
  },
  methods:{
    getList(data){
        Api.getList(data).then(res=>{
            console.log(res)
            this.list = res.data
        })
    },
    searchFn(){
      this.getList(this.search)
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .box p{
    text-align: center;
    margin: 10px auto;
    font-weight: 800;
    font-size: 16px;
  }
  .search{
    display: flex;
    width: 1000px;
    margin: 0 auto;
  }
  .search span{
    width: 200px;
    padding-left: 10px;
    line-height: 35px;
  }
</style>
